package org.devbg.academy.corejava.shop.ui.models;

import javax.swing.tree.DefaultMutableTreeNode;

import org.devbg.academy.corejava.shop.db.entities.Category;

public class CategoryTreeNode extends DefaultMutableTreeNode {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Category category;

	public CategoryTreeNode(Category category) {
		super(category.getName());
		this.category = category;
	}

	public CategoryTreeNode() {
		super();
	}

	@Override
	public boolean isLeaf() {
		return !(this.category.getChildCategories().size() > 0);
	}

	public Category getCategory() {
		return category;
	}
}
